var request = require('request');// 请求 第三方Api
var loggerInfo = require('./winston-date').logger;// 自定义打印 包含日志文件分割功能
var loggerReeor = require('./winston-date').loggerError;
var ajax = function (obj) {
    loggerInfo.info("ajax obj >>>>",obj);
    return new Promise((resolve, reject) => {
        request(obj, function (error, response, body) {
            //loggerInfo.info("request >>>>",error, response, body);
            if (!error && response.statusCode == 200) {
                resolve(JSON.parse(body));
            }else{
                resolve(err);
            }
        })
    })
}
module.exports=ajax;